.SUFFIXES : .o .c .f .f90 .cpp
#
SHELL = /bin/sh
# compiler
FC = gfortran
CC = $(FC)

# optimization flags
#OFLAG = -O3 

# Fortran and C flags
FFLAGS = $(DFLAGS) $(OFLAG) $(DEBUG)
CFLAGS = $(DFLAGS) $(OFLAG) $(DEBUG)
 
# Fortran 90/95 format
#FREE = -FR
FREE = -ffree-form -ffree-line-length-none
 
# Debug flags
DEBUG  = -g -fbacktrace #-D_DEBUG
#
# MPI or OpenMP
#MPI = -DOMP -fopenmp
#
#====================================================================
BASE = alkene
# source and rules
#====================================================================
SOURCE = prec.o vardef.o error.o alkene.o wall.o lc5cb.o   \
         region.o rotate.o translate.o distance.o water.o  \
			alkane.o beta_alkene.o dye.o readmol.o h2.o       \
         dispinfo.o writexyz.o output.o main.o

all:  ${BASE}

${BASE}:  $(SOURCE)
	$(FC) $(SOURCE) $(OFLAG) $(LIB) $(MPI) -o $@

clean: 
	rm -f *.o *~ *.mod ${BASE}

tar:
	rm -f ${BASE}.tar; tar -czvf ${BASE}.tar.gz *.f90 Makefile MAKE/Make.* README


.f.o:
	$(FC) $(FFLAGS)         $(MPI) -c $<
.f90.o:
	$(FC) $(FFLAGS) $(FREE) $(MPI) -c $<
.c.o:
	$(CC) $(CFLAGS) $(MPI)         -c $<
.cpp.o:
	$(CC) $(CFLAGS) $(MPI)         -c $<
